// 使用Boolean函数
// 数字转bool, 除了0和NaN, 其余都为true
const a = '123';
const b = Boolean(a);
console.log('b: ', b, typeof b); // b:  true boolean

// 字符串转bool, 除了'', 其余都为true
const c = '';
const d = Boolean(c);
console.log('d: ', d, typeof d); // d:  false boolean

// null和undefined转bool, 都为false
const e = null;
const f = Boolean(e);
console.log('f: ', f, typeof f); // f:  false boolean

const g = undefined;
const h = Boolean(g);
console.log('h: ', h, typeof h); // h:  false boolean

// 对象也会转换为true
